<!-- <template>
	<view class="main">
		<navbar title="" background="" titleColor="#FFFFFF" backColor="#FFFFFF">
		</navbar>
		<view @click="navTo('/pages/home/rule', {type:'invite'})" style="z-index:99999;text-align:center;position:absolute;;top:calc(var(--status-bar-height) + 14rpx);right:40rpx;width: 110rpx;height:56rpx;line-height:56rpx;background:rgba(15, 15, 14, 0.5);color: #fff;font-size:26rpx;
border-radius: 25rpx;">{{ $t("common.rules")}}</view>
		<view class="invite1">
			<view class="content1">
				<view class="bonus">
					{{ $t('new.invitetitle1') }}
					<text style="color:#FC3E32;">{{systemInfo.invite_rate}}%</text>
					{{ $t('new.invitetitle2') }}
				</view>
				<view class="award">
					{{$currency + (systemInfo.big_money || 0)}}
				</view>
				<view>
					{{$t('new.upto')}}
				</view>
				<view class="step">
					<view class="item">
						<image src="@/static/image/invite/invite_icon.png" style="width: 54rpx;height:53rpx;" mode="" />
						<view>
							{{$t('invite.share')}}
						</view>
					</view>
					<image src="@/static/image/invite/next_icon.png"
						style="width:26rpx;height:34rpx;margin: 0 0;margin-top: -30rpx;" mode="" />
					<view class="item">
						<image src="@/static/image/invite/wallet_icon.png" style="width: 54rpx;height:53rpx;" mode="" />
						<view>
							{{$t('invite.topup')}}
						</view>
					</view>
					<image src="@/static/image/invite/next_icon.png"
						style="width:26rpx;height:34rpx;margin: 0 0;margin-top: -30rpx;" mode="" />
					<view class="item">
						<image src="@/static/image/invite/award_icon.png" style="width: 54rpx;height:53rpx;" mode="" />
						<view>
							{{$t('invite.receive')}}
						</view>
					</view>
				</view>
				<view class="now">
					<view class="now1" @click="handleInvite">
						{{ $t('invite.now') }}
					</view>
				</view>
			</view>

			<view class="content2">
				<view class="u-flex" style="margin-top: 50rpx;">
					<view class="code-label">
						{{$t('invite.mycode',{code: userInfo.invite_code})}}
					</view>
					<view class="copy" @click="handleCopy('code')">
						{{$t('invite.copy')}}
					</view>
				</view>
				<view class="u-flex" style="margin-top: 49rpx;">
					<view class="link-label">
						{{$t('invite.link')}}
					</view>
					<view class="bg u-flex u-row-between">
						<view class="link u-line-1">{{systemInfo.invite_url || 'www'}}</view>
						<view class="copy" @click="handleCopy('link')">{{$t('invite.copy')}}</view>
					</view>
				</view>
			</view>
		</view>

		<view class="num">
			<view class="num1">
				<view class="count">
					{{ inviteInfo.total_invite }}
				</view>
				<view class="of">
					{{ $t('invite.of') }}
				</view>
			</view>
			<view class="num2">
				<view class="count">
					{{ $currency + inviteInfo.total_bonus }}
				</view>
				<view class="of">
					{{ $t('invite.totalbonus') }}
				</view>
			</view>
		</view>
		<view style="width:100vw;height:20rpx;background:#F6F6F6;"></view>
		<view class="">
			<view class="radius1">

			</view>
			<view class="msg">
				<view class="radius2">

				</view>
				<view class="my">
					{{ $t('invite.my') }}
				</view>
				<view class="to">
					{{ $t('invite.to', {price:  inviteInfo.will_get_bonus })}}
				</view>
			</view>
		</view>
		<template v-if="list.length">
			<view class="" v-for="item in list">
				<view class="player">
					<view class="tu">
						<view class="tu1">
							<u-image :src="item.avatar" mode="" width="80rpx" height="80rpx" shape="circle">
								<u-image slot="error" :show-loading="false" src="@/static/image/home/avatar.png"
									width="80rpx" height="80rpx" />
							</u-image>
						</view>
						<view class="tu2">
							<image :src="`../../static/wode/LV${item.level}.png`" mode="" class="tu2-img"></image>
						</view>
					</view>
					<view class="msg3">
						<view class="msg2">
							<view class="name">
								{{item.nickname}}
							</view>
							<view class="pay">
								{{item.status==0?$t('invite.unabledesc'):($t('invite.alreadydesc')+ ' ' + $currency + item.recharge)}}
							</view>
						</view>
						<view class="" @click="receiveClick(item)">
							<view class="state2 state1" v-if="item.status == 2">
								{{$currency + item.moneys}}<br />{{$t('invite.collectedbtn')}}
							</view>
							<view class="state2" v-if="item.status == 1">
								{{$currency + item.moneys}}<br />{{$t('invite.alreadybtn')}}
							</view>
							<view class="state2" v-if="item.status == 0">
								{{$t('invite.unablebtn')}}
							</view>
						</view>
					</view>
				</view>
				<view class="line">
				</view>
			</view>
			<view class="click" @click="loadList" v-if="!noMoreFriends">
				<u-image src="../../static/image/invite/next.png" width="30rpx" height="20rpx" mode=""
					style="margin: 30rpx auto 0;"></u-image>
				<view class="click-font">
					{{ $t('invite.click')}}
				</view>
			</view>
		</template>
		
		<mnodata v-else></mnodata>
		<sharepopup ref="pop" :showPopup="showpop" shareType="3"></sharepopup>
		<tabbar page="/pages/team/invite"></tabbar>
	</view>
</template> -->


<template>
	<view class="zy-column-full">
		<zy-title title="Orders" hide-back></zy-title>
		<scroll-view  class="zy-scroll zy-page-padding" scroll-y>
			<order-item @click.native="open1"></order-item>
			<order-item @click.native="open2"></order-item>
			<order-item disable></order-item>
		</scroll-view>
		<sharepopup ref="pop" :showPopup="showpop" shareType="3"></sharepopup>
		<tabbar page="/pages/team/invite"></tabbar>
		
		<popup-order ref="order"></popup-order>
		<popup-order2 ref="eeeee"></popup-order2>
	</view>
</template>

<script>
	import {
		userinfo,
		rewardlist,
		rewardfor
	} from '@/api/useraward.js'
	import {
		copyString
	} from '@/utils/utils.js'
	export default {
		data() {
			return {
				inviteInfo: {},
				list: [

				],
				showpop: false,
				pageNum: 0,
				noMoreFriends: false
			}
		},
		onLoad() {
			this.loadInfo();
			this.loadList();
		},
		computed: {
			userInfo() {
				return this.$store.getters.userInfo || {}
			},
			systemInfo() {
				return this.$store.getters.systemInfo || {}
			},
		},
		methods: {
			async loadInfo() {
				let result = await userinfo();
				this.inviteInfo = result;
			},
			async loadList() {
				this.pageNum++;
				let result = await rewardlist({
					page: this.pageNum
				});
				if (this.pageNum == 1) {
					this.list = []
				}
				this.list = this.list.concat(result);
				if (result.length <= 10) {
					this.noMoreFriends = true;
				}
			},
			handleCopy(val) {
				if (val == 'code') {
					copyString(this.userInfo.invite_code)
				}
				if (val == 'link') {
					copyString(this.systemInfo.invite_url)
				}
			},
			handleInvite() {
				this.$refs.pop.open()
			},
			navTo(val, data) {
				let param = '';
				if (data) {
					param = '?';
					for (let i in data) {
						param += `${i}=${data[i]}&`
					}
				}
				uni.navigateTo({
					url: val + param
				})
			},
			async receiveClick(val) {
				uni.showLoading();
				let result = await rewardfor({
					id: val.id
				})
				this.pageNum = 0
				this.$store.dispatch('getUserInfo')
				uni.hideLoading();
				this.loadInfo();
				this.loadList();
			},
			open1(){
				this.$refs.order.open()
			},
			open2(){
				this.$refs.eeeee.open()
			}
		}
	}
</script>
<style lang="scss">
	page {
		background-color: #fff;
	}
</style>
<style lang="scss" scoped>
	.main {
		padding-bottom: 208rpx;
		background: url(../../static/image/invite/friends.png) no-repeat;
		background-color: transparent;
		background-size: 100% 1328rpx;
		background-position: center top;
	}

	.invite1 {
		width: 710rpx;
		height: 866rpx;
		margin: 380rpx 0 0 30rpx;
		background-size: 100%;
		background: url(../../static/image/invite/content-bg.png) no-repeat;
		background-color: transparent;
		background-size: 710rpx 866rpx;
		background-position: center top;
	}

	.content1 {
		height: 552rpx;
		margin-left: -12rpx;
		padding: 0 40rpx 0 32rpx;
		position: relative;
		overflow: hidden;
		text-align: center;

		.award {
			margin-top: 40rpx;
			font-size: 70rpx;
			color: #FC3E32;
		}

		.bonus {
			margin: auto;
			margin-top: 45rpx;
			color: #23262F;
			width: 510rpx;
		}

		.step {
			margin-top: 35rpx;
			display: flex;
			justify-content: center;
			font-size: 26rpx;
			align-items: center;

			.item {
				width: 30%;
				overflow: visible;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
		}
	}

	.content2 {
		height: 314rpx;
		margin-left: -12rpx;
		padding: 0 40rpx 0 72rpx;
		position: relative;
		overflow: hidden;
		text-align: center;

		.code-label {
			color: #CD1A1A;
			font-size: 30rpx;
		}

		.copy {
			color: #2399FD;
			text-decoration: underline;
			margin-left: 30rpx;
		}

		.bg {
			background: #F6F6F6;
			border-radius: 10rpx;
			padding: 21rpx;
			width: 462rpx;
			margin-left: 16rpx;
		}

		.link {
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
			color: #AAAAAA;
		}
	}

	.now {
		.now1 {
			line-height: 90rpx;
			font-size: 30rpx;
			font-family: Rubik;
			font-weight: 400;
			color: rgb(255, 216, 85);
			text-align: center;
		}

		width: 590rpx;
		height: 90rpx;
		background: #0F0F0E;
		border-radius: 10rpx;
		margin: auto;
		margin-top: 50rpx;
	}

	.num {
		display: flex;
		margin: 59rpx 40rpx 59rpx;

		.num1 {
			background-image: url(../../static/image/invite/number.png);
			background-size: 100%;
			margin-right: 30rpx;
			width: 320rpx;
			height: 171rpx;

			.count1 {
				font-size: 50rpx;
				font-family: Rubik;
				font-weight: 500;
				color: #FFFFFF;
				margin-top: 28rpx;
				text-align: center;
			}

		}

		.num2 {
			background-image: url(../../static/image/invite/bonus.png);
			background-size: 100%;
			width: 320rpx;
			height: 171rpx;

		}

		.count {
			font-size: 50rpx;
			font-family: Rubik;
			font-weight: 500;
			color: #FFFFFF;
			margin-top: 28rpx;
			text-align: center;
		}

		.of {
			font-size: 28rpx;
			text-align: center;
			font-family: Rubik;
			font-weight: 400;
			color: #FFFFFF;
			margin: 8rpx 36rpx 0;
		}
	}

	.radius1 {
		width: 16rpx;
		height: 16rpx;
		background: $u-type-primary;
		border-radius: 50%;
		margin-left: 66rpx;
		margin-top: 40rpx;
	}

	.msg {
		display: flex;

		.radius2 {
			width: 30rpx;
			height: 30rpx;
			background: $u-type-primary;
			border-radius: 50%;
			margin-left: 40rpx;
		}

		.my {
			font-size: 32rpx;
			font-family: Rubik;
			font-weight: 500;
			color: #0F0F0E;
			line-height: 22rpx;
			margin-left: -4rpx;
		}

		.to {
			font-size: 28rpx;
			font-family: Rubik;
			font-weight: 400;
			color: #FC3E32;
			margin-left: 188rpx;
			margin-top: -8rpx;
		}
	}

	.player {
		display: flex;
		margin-top: 40rpx;
		margin-left: 40rpx;

		.tu {

			.tu1 {}

			.tu2 {
				width: 78rpx;
				height: 31rpx;
				margin-top: -24rpx;

				.tu2-img {
					width: 78rpx;
					height: 31rpx;
					margin-top: -20rpx;
				}
			}

		}

	}

	.msg3 {
		display: flex;

		.msg2 {
			width: 300rpx;
			margin-left: 29rpx;

			.name {
				font-size: 32rpx;
				font-family: Rubik;
				font-weight: 400;
				color: #0F0F0E;
			}

			.pay {
				margin-top: 10rpx;
				font-size: 30rpx;
				font-family: Rubik;
				font-weight: 400;
				color: #878D9C;
			}

		}
	}

	.state2 {
		margin-top: 12rpx;
		margin-left: 38rpx;
		width: 210rpx;
		height: 70rpx;
		background: #ECECEC;
		border-radius: 10rpx;
		font-size: 24rpx;
		font-family: Rubik;
		font-weight: 400;
		color: #65676B;
		text-align: center;
		display: flex;
		align-items: center;
		justify-content: space-around;
		flex-direction: column;
	}

	.state1 {
		background: #0F0F0E;
		color: #FFD855;
	}

	.line {
		width: 670rpx;
		height: 2rpx;
		background: #ECECEC;
		margin-top: 40rpx;
		margin-left: 40rpx;

	}

	.click-font {
		text-align: center;
		color: #AAAAAA;
		font-size: 24rpx;
		margin-top: 10rpx;
		padding-bottom: 100rpx;
	}
</style>